package com.xuecheng.order.job;

import com.xuecheng.order.service.OrdersService;
import lombok.extern.slf4j.Slf4j;

import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
//定时清理未支付订单
public class OrderClear {
    @Autowired
    private OrdersService ordersService;
    //每间隔30秒查询一次订单表
    @Scheduled(cron = "0/30 * * * * ?")
    public void clearOrder(){
        log.info("清理超时订单。。。。");
        //调用service
        ordersService.clearOrder();
    }
}
